import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import postcsspxtoviewport8plugin from 'postcss-px-to-viewport-8-plugin';

// https://vite.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    proxy: {
      '/api': {
        target: 'http://113.44.139.133:8005',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    }
  },
  css: {
    postcss: {
      plugins: [
        postcsspxtoviewport8plugin(
          {
            unitToConvert: 'px',
            viewportWidth: 375,
            unitPrecision: 5,
            propList: ['*'],
            viewportUnit: 'vw',
            fontViewportUnit: 'vw',
            selectorBlackList: [],
            minPixelValue: 1,
            mediaQuery: false,
            replace: true,
            exclude: [],
            landscape: false,
            landscapeUnit: 'vw',
            landscapeWidth: 568
          }
        )
      ]
    }
  }
})
